package com.gsm.beetl.controller;

import com.gsm.beetl.model.BeetlUser;
import org.dom4j.rule.Mode;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by lijs on 2016-07-16 下午4:09.
 */
@Controller
@RequestMapping(value = "/beetl")
public class UserBeetlController {

    @RequestMapping(value = "/user/{name}.html",method = RequestMethod.GET)
    public ModelAndView user(@PathVariable("name") String name) {
        ModelAndView mv = new ModelAndView("user");

        if (!StringUtils.isEmpty(name)) {
            BeetlUser beetlUser = new BeetlUser();
            beetlUser.setName(name);
            beetlUser.setAddr("addr");
            beetlUser.setAge(30);
            mv.addObject("user", beetlUser);
        }
        return mv;
    }
}
